package za.org.jcicada.genss.sensor.messages;

import za.org.jcicada.genss.messages.BaseMessage;
import za.org.jcicada.genss.sensor.ISensor;
import za.org.jcicada.genss.sensor.ISensorType;
import za.org.jcicada.genss.sensor.SensorURN;
import za.org.jcicada.genss.sensor.impl.Sensor;

/**
 * UpdateSensorTypeInform message class
 * @author rcrida
 */
public class UpdateSensorTypeInform extends BaseMessage {
    
    /**
     * Class serialization version id.
     */
    private static final long serialVersionUID = 1L;
    
    /**
     * The sensor URI that the type information is for
     */
    SensorURN sensorURN;
    
    /**
     * The sensor type
     */
    ISensorType type;
    
    /**
     * The sensor name
     */
    String name;
    
    /**
     * The sensor description
     */
    String description;
    
    /**
     * The sensor units
     */
    String units;

    /**
     * Construct message
     * @param sensorURN the sensor URI
     * @param sensor the sensor object containing all type information
     */
    public UpdateSensorTypeInform(SensorURN sensorURN, ISensor sensor) {
        this.sensorURN = sensorURN;
        type = sensor.getType();
        name = sensor.getName();
        description = sensor.getDescription();
        units = sensor.getUnits();
    }
    
    public SensorURN getSensorURN() {
        return sensorURN;
    }
    
    public ISensor getSensor() {
        return new Sensor(type, name, description, units);
    }

}
